import Vue from "vue";
import VueRouter from "vue-router";
import Home from "@/views/layout";
import Detail from "@/views/detail";
import Index from "@/views/index.vue";
import Find from "@/views/find.vue";
import BaiduMap from "@/views/baiduMap.vue";
Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect: "/home",
  },
  {
    path: "/home",
    component: Home,
    children: [
      {
        path: "index",
        component: Index,
      },
      {
        path: "find",
        component: Find,
      },
      {
        path: 'ask',
        component: () => import('@/views/ask')
      },
      {
        path: 'my',
        component: () => import('@/views/my')
      }
    ],
  },
  {
    path: "/detail",
    component: Detail,
  },
  {
    path: '/login',
    component: () => import('@/views/login')
  },
  {
    path: '/register',
    component: () => import('@/views/register')
  },
  {
    path: '/collect',
    component: () => import('@/views/collect')
  },
  {
    path: '/manage',
    component: () => import('@/views/manage')
  },
  {
    path: '/house',
    component: () => import('@/views/house')
  },
  {
    path: "/baiduMap",
    component:BaiduMap,
  },
  {
    path: '/areaname',
    component: () => import('@/views/areaname')
  },
  {
    path: '/citylist',
    component: () => import('@/views/citylist')
  },
];

const router = new VueRouter({
  routes,
});

export default router;
